home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
B-Business
/
(c)b3.d64
/
word pro 64.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2008-11-26
|
5KB
|
166 lines
100 GOTO400
110 PRINT" PRESS SPACE BAR WHEN READY"
120 GETA$:IFA$<>" "THEN120
130 RETURN
135 REM ***EDIT ROUTINES***
140 PRINT"[147]";:FORI=0TO9:IFN+I>CTHENRETURN
150 PRINTN+I;RIGHT$(A$(N+I),LEN(A$(N+I))-1):NEXT:RETURN
160 PRINT""CHR$(34)CHR$(34)CHR$(20)""SPC(A+2)"^";
170 POKE631,29:POKE198,1:RETURN
180 PRINT"MAX";A;"CHARACTERS/LINE":RETURN
190 PRINT"[147]"A$" NOT POSIBLE MEMORY FULL":GOSUB110:GOTO900
210 GETA$:IFA$<>"Y"ANDA$<>"N"THEN210
220 RETURN
240 FR=FRE(0)-(FRE(0)<0)*65536:RETURN
260 REM ***TAPE FILES***
270 PRINT"[147]NAME OF FILE _____ IF NO NAME HIT":INPUT" RETURN [223][157][157][157]";A$
280 IFA$="[223]"THENA$=""
295 POKE788,49:OPEN1,1,B,A$:RETURN
300 B=1:GOSUB270:FORI=1TOC:PRINT#1,CHR$(34)+A$(I):NEXT:CLOSE1:GOTO1400
320 D=-1:GOSUB330:C=C-1:FORI=BTOC:A$(I)=A$(I+1):NEXT:A$(I)="":RETURN
330 L=L+LEN(A$(B))*D:IFL>.7*YORC=MTHENE=2
340 RETURN
350 R=0:D=D+1:IFD>NTHEND=2:IFQ=0THENRETURN REM ***JUSTIFICATION***
360 IFMID$(A$,D,1)<>" "THENR=1
370 IFQ=RTHENRETURN
380 GOTO350
390 REM ***INITIALIZE PROGRAM***
400 POKE788,52:PRINT"[147]"CHR$(142):INPUT"MAX LINE LENGHT";A:IFA=0THENA=70
410 IFA>70THEN400
430 PRINT"AUTOMATIC CARRIAGE RETURN"
440 PRINT"BETWEEN POSITION "A-7"AND"A
450 INPUT"NUMBER OF TABS";T:IFT=0THEN510
460 IFT>10THENPRINT"[147]";:GOTO450
470 PRINT"DEFINE TAB POSITIONS"
480 PRINT"BETWEEN 1 AND "A:PRINT:FORI=1TOT
490 PRINT"TAB NO.";I;:INPUTT%(I):IFT%(I)>ATHEN490
500 NEXT
510 GOSUB240:M=INT(FR/A)+10:Z=INT(.9*M):DIMA$(M):GOSUB240:Y=FR
515 C=1:D=0:E=0:A$(1)="":GOTO1400
518 REM *** READ FROM TAPE ***
520 B=0:GOSUB270
530 FORC=1TOZ:INPUT#1,A$(C):L=L+LEN(A$(C))
540 IFST=64THENPRINT"[147]FILE ";A$;" FOUND[146]":GOSUB110:CLOSE1:GOTO880
550 IFL>.7*YTHEN870
560 NEXT:C=C-1:GOTO870
580 REM *** TEXT WRITING ***
590 POKE204,1:PRINTCHR$(14)"[147]"A$(C);
600 GETA$:IFA$=""THEN600
610 I=ASC(A$)AND127:IFI=13THEN750
620 IF(D=1ANDA$=" ")ORI=3ORI=17ORI=19ORI=18ORI=29ORI=34THEN600
630 D=0:IFASC(A$)=133THENPRINT"[147]";:GOTO1400
640 IFA$=","THENA$=","
650 IFI=59THENA$=";"
660 IFA$=";"THENA$=";"
670 IFA$=":"THENA$=":"
680 IFI=95THEN830
690 IFI<>20ANDI<>94THENPRINTA$;:GOTO790
700 IFLEN(A$(C))=1THEN720
710 A$(C)=LEFT$(A$(C),LEN(A$(C))-1):PRINTCHR$(20);:GOTO600
720 A$(C)="":C=C-1:L=L-LEN(A$(C))
730 IFLEN(A$(C))>39THENPRINT"[146] [157][145]";
740 PRINT"[146] [157][145]"RIGHT$(A$(C),LEN(A$(C))-1);:GOTO600
750 IFLEN(A$(C))<=39THENX=225+PEEK(214):POKEX,(PEEK(X)OR128)
760 PRINT"[146] "CHR$(13);:E=0:L=L+LEN(A$(C))
770 IFC=ZORL>.8*YTHENPRINT"[147]":GOTO860
780 C=C+1:A$(C)="":GOTO600
790 IFE=0ANDLEN(A$(C))>A-7ANDA$=" "THEN820
800 A$(C)=A$(C)+A$
810 IFLEN(A$(C))<A+1THEN600.
820 D=1:GOTO760
830 FORQ=1TOT:IFPEEK(211)>=T%(Q)-1THENNEXT:GOTO600
840 P=T%(Q)-PEEK(211)-1:FORW=1TOP:A$(C)=A$(C)+" ":PRINT" ";:NEXT
850 E=(Q=T)*(T<>1):GOTO600
860 REM ***DISPLAY/EDIT ROUTINE***
870 PRINT"[147]MEMORY FULL.":GOSUB110
880 REM
890 N=1:INPUT"STARTING LINE#";N:PRINTCHR$(14)
900 GOSUB140:IFI=0THEN1400
910 PRINT:PRINT"[195][146]HANGE [196][146]ELETE [201][146]NSERT [204][146]INK"
920 PRINT" E[216][146]IT [198][146]ORWARD [210][146]EVERSE"
930 GETA$:IF(A$="R"ANDN>10)ORA$="F"THENN=N+10*(A$="R")-10*(A$="F"):GOTO900
940 IFA$="X"THEN1400
950 IFA$=""OR(A$<>"D"ANDA$<>"C"ANDA$<>"I"ANDA$<>"L")THEN930
960 PRINT""A$
970 INPUT"[204]INE# ";B
990 IFB>CORB<0THEN970
995 IFB=0THEN890
1000 PRINT"[147]LINE #"B
1010 IFA$="D"THENGOSUB320:GOTO900
1020 IFA$="I"GOTO1080
1030 IFA$="L"THEN1120
1040 IFE=2THENIFFR<250THENA$="CHANGE":GOTO190
1050 D=-1:GOSUB330:GOSUB160:PRINTRIGHT$(A$(B),LEN(A$(B))-1);:INPUT"";A$
1060 IFLEN(A$)>ATHENGOSUB180:GOTO1050
1070 A$(B)=""+A$:D=1:GOSUB330:GOTO900
1080 IFE=2THENIFR<300ORC=MTHENA$="INSERT":GOTO190
1090 FORI=CTOBSTEP-1:A$(I+1)=A$(I):NEXT:C=C+1
1100 GOSUB160:INPUT"";A$:IFLEN(A$)>ATHENGOSUB180:GOTO1100
1110 GOTO1070
1120 FORR=BTOC-1:A$=A$(R):E$=A$(R+1):W=LEN(A$):K=LEN(E$):IFK<2ORW=1THEN900
1130 IFW>A-7THENNEXT:GOTO900
1140 IFMID$(E$,2,1)=" "THEN900
1150 IFK<A-6-WTHEN1180
1160 FORB=A-5-WTOK-1:IFMID$(E$,B,1)=" "ORB>A+1-WTHEN1190
1170 NEXT
1180 A$(R)=A$+" "+RIGHT$(E$,K-1):B=R+1:GOSUB320:NEXTR:GOTO900
1190 A$(R)=A$+" "+MID$ (E$,2,B-2):IFMID$(E$,B+1,1)=" "THENB=B+1
1200 A$(R+1)=""+RIGHT$(E$,K-B):NEXTR:GOTO900
1230 REM *** PRINTER ROUTINE ***
1240 PRINT"[147]TURN ON PRINTER":GOSUB110:POKE788,49:OPEN4,4,7
1245 G=0:PRINT"CONFIGURE PRINT ROUTINE?":GOSUB210:IFA$="N"THEN1280
1250 PRINT"[147]DOUBLE LINE-FEED?":GOSUB 210:S=(A$="Y")
1260 INPUT"MAX. LINES/PAGE[191][157][157][157]";H
1270 INPUT"LEFT MARGIN[191][157][157][157]";Q$
1280 PRINT"JUSTIFICATION?":GOSUB210:B$=A$:D=1:PRINT"[147]":FORI=1TOC:A$=A$(I)
1285 N=LEN(A$):P=LEN(A$(I+1)):IFB$="N"ORI=CTHEN1340
1290 IFP<>1THENIFMID$(A$(I+1),2,1)<>" "ANDN>A-7THEN1310
1300 GOTO1340
1310 IFN=A+1THEN1340
1320 Q=1:GOSUB350:Q=0:GOSUB350:IFD=2THEN1320
1330 A$=LEFT$(A$,D)+" "+MID$(A$,D+1):N=N+1:GOTO1310
1340 PRINTRIGHT$(A$,N-1):PRINT#4,CHR(16)(Q$)A$:G=G+1:IFS=-1THENPRINT#4
1350 IFG<>HTHEN1370
1360 PRINT"[147]MAX.";H;"LINES/PAGE":PRINT"ADJUST PAPER "
1361 GOSUB110:G=0:PRINT"[147]"
1370 NEXT:CLOSE4
1400 POKE788,52:PRINTCHR$(142);"[147] ***MAIN MENU***
1410 [153]" [F1] ADD TEXT
1420 PRINT" [F2] READ FROM TAPE
1430 [153]" [F3] REVIEW/EDIT TEXT
1440 PRINT" [F4] SAVE TEXT ON TAPE
1450 [153]" [F5] PRINT HARD COPY
1460 PRINT" [F6] QUIT
1465 [153]" [F7] INSTRUCTIONS
1470 GOSUB240:PRINT" BYTES FREE "FR"[146]":PRINT" SELECT F1-F6"
1480 GETA$:IFA$=""THEN1480
1490 IFPEEK(197)<3ORPEEK(197)>6THEN1480
1500 X=ASC(A$)-132
1510 ONXGOTO590,890,1240,1550,520,300,1520,1480
1520 POKE788,49:END
1540 REM ***INSTRUCTIONS***
1550 PRINT"[147]WORD PRO[146] IS A SIMPLE EASY TEXT PROCESSOR
1560 [153]"IT FEATURES:
1580 PRINT"UP TO 70 CHARACTERS/LINE (MAX.)
1590 [153]"UP TO 10 TABS
1595 PRINT"JUSTIFICATION OF RIGHT MARGIN
1596 [153]"RUN/STOP DISABLED (WITH POKE788,52 NORMAL VALUE IS POKE788,49)
1600 GOSUB110:PRINT"[147]NOTES WHEN ENTERING TEXT:
1615 [153]"PRESS '_' FOR TAB
1617 PRINT"USE RETURN KEY TO START NEW LINE
1620 [153]"USE INST/DEL FOR CORRECTIONS
1630 PRINT"CURSOR KEYS DO NOT WORK IN THIS MODE
1640 [153]"WHEN FINISHED WITH TEXT PRESS [F1]":[141]110
1650 [153]"LOADREVIEW/EDIT NOTES:
1655 PRINT"(CURSOR CONTROL KEYS CAN BE USED IN THIS MODE)
1660 [153]"PRESSING =RESULT
1670 PRINT"'C'+LINE#=ALLOWS YOU TO EDIT LINE
1680 [153]"'D'+LINE#=DELETES THAT LINE
1690 PRINT"'I'+LINE#=INSERTS NEW LINE
1700 [153]"'L'+LINE#=LINKS THAT LINE AND NEXT LINE (UP TO MAX LINE LENGHT)
1710 PRINT"'F' =DISPLAYS NEXT BLOCK OF TEXT
1720 [153]"'R' =DISPLAYS PRECEEDING BLOCK OF TEXT
1730 PRINT"'X' =CONTINUES WITH PROGRAM
1740 [153]"(NOTE) USE LINE# OF '0' TO ABORT EDITING
1800 GOSUB110:GOTO1400